<?php
namespace api\modules\v1\controllers;

use api\modules\BaseActiveController;

use yii\filters\auth\CompositeAuth;
use yii\filters\auth\QueryParamAuth;
use yii\data\ActiveDataProvider;
use yii\filters\ContentNegotiator;
use yii\web\Response;

use yii\helpers\ArrayHelper;
use yii\filters\auth\HttpBasicAuth;
class TestController extends BaseActiveController
{
    public $modelClass = 'common\models\User';

    public function behaviors()
    {
        $behaviors = parent::behaviors();
        $behaviors['authenticator'] = [
            'class' => CompositeAuth::className(),
            'authMethods' => [
                QueryParamAuth::className(),
            ],
        ];

        return $behaviors;
    }

    public function actions()
    {
        $actions = parent::actions();
        // 注销系统自带的实现方法
//        unset($actions['index'], $actions['update'], $actions['create'], $actions['delete'], $actions['view']);
        return $actions;
    }

    public function actionIndex(){
        $activeData = new ActiveDataProvider([
            'query' => Stnk::find(),
            'pagination' => [
                'defaultPageSize' => 2,
            ],
        ]);
        return $activeData;
    }

    public function actionTest()
    {
        return $this->renderJson([
            'result'=> false,
            'message'=> "测试用例",
        ]);
    }

}